//
/***********************************************************
             File name:      main.c
             Author:         Bitat (陆叁柒)
             Email :         Bitat@qq.com
             Gitee :         https://gitee.com/bitat
             CSDN  :         https://blog.csdn.net/bitat 
             History:        2023/1/16
************************************************************/

//利用第三个变量进行交换数组每一个元素

#include <stdio.h>

int main()
{
    int arr1[5] = {1,2,3,4,5};
    int arr2[5] = {6,7,8,9,10};
    int arr3[5] = {0};
    int i = 0;
    for(i = 0; i < 5; i++)
    {
        arr3[i] = arr1[i];
        arr1[i] = arr2[i];
        arr2[i] = arr3[i];
    }
    printf("交换后arr1: ");
    for(i = 0; i < 5; i++)
    {
        printf("%d ",arr1[i]);
    }
    printf("\n");
    printf("交换后arr2: ");
    for(i = 0; i < 5; i++)
    {
        printf("%d ",arr2[i]);
    }
    printf("\n");

    return 0;
}
